package com.db.service;

import java.util.List;

import javax.swing.JOptionPane;
import javax.swing.JPasswordField;
import javax.swing.JTextField;

import com.component.LogingFrame;
import com.data.Data;
import com.db.bean.User;
import com.db.dao.UserDAOImpl;
import com.db.sevent.GroupEvent;
import com.main.RunFrame;

/**
* @author 作者:秋哲    E-mail:2810201146@qq.com:
* @version 创建时间：2020年5月21日 下午5:38:49
* @description: 
*/
public class UserServer {
	//登录 
	public User login(String username,String password) {
		User obj = new com.db.dao.UserDAOImpl().getUser(username,password);
		Data.UserBean = obj;
		return obj;
	};
	

	//获取个人信息 
	public void getinformation() {
		String name = Data.UserBean.getName();
	};
	//修改密码 
	public int changePasswork(String password) {
		Data.UserBean.setPassword(password);
		return new UserDAOImpl().updateUser(Data.UserBean);
	};
	//获取班级名单
	public void getPresidentUserAll() {
		int president_id = Data.UserBean.getPresident_id();
		System.out.println("班级ID:"+president_id);
		List<User> userAll = new UserDAOImpl().getPresidentUserAll(president_id);
		for (User user : userAll) {
			Data.userAll.put(user.getName(), user.getId());
			Data.userHashAll.put(user.getName(), user);
		}
	}
}
